<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary x:Class="OpenLS.Drawing.UI.ShapeResources"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:drawingui="clr-namespace:OpenLS.Drawing.UI"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xdr="http://schemas.Kherty.com/office/2007/drawing"
                    xmlns:drawing2="clr-namespace:OpenLS.Drawing.UI" xmlns:Internals="clr-namespace:OpenLS.Drawing.UI.Internals">
  <DataTemplate DataType="{x:Type xdr:Shape}">
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="{Binding Path=Width}"
          Height="{Binding Path=Height}">
      <TextElement.Foreground>
        <MultiBinding Converter="{x:Static Internals:DrawingConverters.ColorBaseToBrushConverter}">
          <Binding Path="Style.FontReference.Color" />
          <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)" />
        </MultiBinding>
      </TextElement.Foreground>
            <Path HorizontalAlignment="Stretch" StrokeThickness="{Binding ShapeProperties.LineProperties.Width, FallbackValue=1}" VerticalAlignment="Top"
            Stretch="Fill" Width="{Binding Path=Width}" Height="{Binding Path=Height}"> <!--BitmapEffect="{Binding BitmapEffect}"> -->
        <Path.Data>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.ToGeometryConverter}">
            <Binding></Binding>
                        <Binding Path="ShapeProperties.Geometry"></Binding>
          </MultiBinding>
        </Path.Data>
        <Path.Fill>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.FillPropertiesToBrushConverter}">
            <Binding Path="ShapeProperties.FillProperties" />
            <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)" />
            <Binding Path="Style.FillReference" />
          </MultiBinding>
        </Path.Fill>
        <Path.Stroke>
          <MultiBinding Converter="{x:Static Internals:DrawingConverters.LineFillPropertiesToBrushConverter}">
            <Binding Path="ShapeProperties.LineProperties.LineFillProperties" />
            <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)" />
            <Binding Path="Style.LineReference" />
          </MultiBinding>
        </Path.Stroke>
      </Path>
            <Path HorizontalAlignment="Stretch" StrokeThickness="{Binding ShapeProperties.LineProperties.Width, FallbackValue=1}" VerticalAlignment="Top"
            Stretch="Fill" Width="{Binding Path=Width}" Height="{Binding Path=Height}">
                <!--BitmapEffect="{Binding BitmapEffect}"> -->
                <Path.Data>
                    <MultiBinding Converter="{x:Static Internals:DrawingConverters.ToArrowGeometryConverter}">
                        <Binding></Binding>
                        <Binding Path="ShapeProperties.Geometry"></Binding>
                    </MultiBinding>
                </Path.Data>
                <Path.Fill>
                    <MultiBinding Converter="{x:Static Internals:DrawingConverters.LineFillPropertiesToBrushConverter}">
                        <Binding Path="ShapeProperties.LineProperties.LineFillProperties" />
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)" />
                        <Binding Path="Style.LineReference" />
                    </MultiBinding>
                </Path.Fill>
                <Path.Stroke>
                    <MultiBinding Converter="{x:Static Internals:DrawingConverters.LineFillPropertiesToBrushConverter}">
                        <Binding Path="ShapeProperties.LineProperties.LineFillProperties" />
                        <Binding RelativeSource="{RelativeSource Self}" Path="(drawing2:DrawingElement.ColorScheme)" />
                        <Binding Path="Style.LineReference" />
                    </MultiBinding>
                </Path.Stroke>
            </Path>
            <ContentControl Content="{Binding TextProperties}" HorizontalAlignment="Center"
                      VerticalAlignment="{Binding Path=TextProperties.VerticalAlignment}" />
    </Grid>
  </DataTemplate>
  <DataTemplate DataType="{x:Type xdr:GroupShape}">
    <ItemsControl ItemsSource="{Binding Items}" HorizontalAlignment="Left" VerticalAlignment="Top">
      <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
          <Canvas />
        </ItemsPanelTemplate>
      </ItemsControl.ItemsPanel>
      <ItemsControl.ItemContainerStyle>
        <Style>
          <Setter Property="Canvas.Left" Value="{Binding Path=ShapeProperties.Xfrm.Offset.X}" />
          <Setter Property="Canvas.Top" Value="{Binding Path=ShapeProperties.Xfrm.Offset.Y}" />
          <!--<Setter Property="Canvas.Left" Value="100"/>
          <Setter Property="Canvas.Top" Value="100"/> -->
        </Style>
      </ItemsControl.ItemContainerStyle>
    </ItemsControl>
  </DataTemplate>

</ResourceDictionary>